const {
  DataTypes
} = require('sequelize');
module.exports = sequelize => {
  const attributes = {
    id: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: null,
      primaryKey: true,
      autoIncrement: true,
      comment: "自增id",
      field: "id"
    },
    warehouse_goods_id: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "仓库商品id",
      field: "warehouse_goods_id"
    },
    warehouse_id: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "仓库id",
      field: "warehouse_id"
    },
    goods_id: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "商品id",
      field: "goods_id"
    },
    md5_key: {
      type: DataTypes.CHAR(32),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "md5key值",
      field: "md5_key"
    },
    spec: {
      type: DataTypes.TEXT,
      allowNull: true,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: "规格值",
      field: "spec"
    },
    inventory: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "库存",
      field: "inventory"
    },
    add_time: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "添加时间",
      field: "add_time"
    }
  };
  const options = {
    tableName: "sxo_warehouse_goods_spec",
    comment: "",
    indexes: [{
      name: "warehouse_goods_id",
      unique: false,
      type: "BTREE",
      fields: ["warehouse_goods_id"]
    }, {
      name: "warehouse_id",
      unique: false,
      type: "BTREE",
      fields: ["warehouse_id"]
    }, {
      name: "goods_id",
      unique: false,
      type: "BTREE",
      fields: ["goods_id"]
    }, {
      name: "md5_key",
      unique: false,
      type: "BTREE",
      fields: ["md5_key"]
    }, {
      name: "inventory",
      unique: false,
      type: "BTREE",
      fields: ["inventory"]
    }]
  };
  const SxoWarehouseGoodsSpecModel = sequelize.define("sxo_warehouse_goods_spec_model", attributes, options);
  return SxoWarehouseGoodsSpecModel;
};